<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 15-3-21
 * Time: 下午10:03
 */

namespace Application\Base;


class mdlBase extends \LibBase
{
    static $CONFIG = array();

    /**
     * 获取DB对象
     * @param string $key
     * @return \Library\database\LibBase mixed
     */
    public function db($key)
    {
        $class = "db";
        if (!isset(self::$CONFIG[$class][$key]) || !(self::$CONFIG[$class][$key] instanceof \Library\database\LibBase)) {
            self::$CONFIG[$class][$key] = \LibFactory::database($key);
        }
        return self::$CONFIG[$class][$key];
    }

    /**
     * @param string $key
     * @return \Library\database\LibBase mixed
     */
    static public function sdb($key = "base")
    {
        return mdlBase::getInstance()->db($key);
    }
}   